<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<div id="app4">
			数A：<input type="number" v-model="num1" ><br />
			数B：<input type="number" v-model="num2" @keyup.enter="sum2()"><br />
			<button @click="sum2()">求和</button><br />
			<!-- 和：<input v-model="sum" /> -->
			和：<span v-text="sum"></span>
		</div>
		
		<script src="../vue.js"></script>
		<script>
			const a2 = new Vue({
				el: '#app4',
				data: {
					num1:'',
					num2: '',
					sum: ''
				},
				methods:{
					sum2: function(){
					this.sum = parseInt(this.num1) + parseInt(this.num2)
					}
				}
			})
		</script>
	</body>
</html>
